package com.sdy.common.utils;

import java.util.Collections;
import java.util.List;

public class ListUtil {
    public static <T> List<T> toPageList(List<T> list, long current, long size) {
        int len = list.size();
        int start = (int) Math.min((current - 1) * size, len);
        int end = (int) Math.min(current * size, len);
        if (start >= len) {
            return Collections.emptyList();
        }
        return list.subList(start, end);
    }
}
